﻿@using HiLand.General.Entity
@model SimpleProductEntity
@{
    this.Layout = null;
    SimpleProductEntity currentProduct = Model;

    string productImageUrl = Url.Content("~/Content/Images/NoImage_180_135.jpg");
    if (currentProduct.ProductMainImage != null)
    {
        string thumbnailUrl = currentProduct.ProductMainImage.EnsureThumbnailAllVirtualPath(180, 135);
        if (string.IsNullOrWhiteSpace(thumbnailUrl) == false)
        {
            productImageUrl = thumbnailUrl;
        }
    }
    
    string productUrl = Url.Action("ProductDetails", "Product", new { productGuid = currentProduct.ProductGuid });
}
<div class="item item-homepage" id="item-@currentProduct.ProductGuid">
    <div class="image">
        <a href="@productUrl">
            <img src="@productImageUrl" title="@Model.ProductName" alt="@currentProduct.ProductName" /></a></div>
    <div class="title">
        <h4>
            <a href="@productUrl">
                @currentProduct.ProductName</a></h4>
    </div>
    <div style="" class="offer">
        <ul>
            <li class="price"><a><span class="amount">@currentProduct.ProductPricePromotion</span></a></li>
            <li class="retail"><a><span class="amount">@currentProduct.ProductPriceReference</span></a></li>
        </ul>
    </div>
    <div>
        <button title="详细信息" type="button" itemGuid="@currentProduct.ProductGuid" name="btnDetails" class="btnDetails btn primary medium blue setalert">
            详细信息</button>
        <div class="break">
        </div>
    </div>
</div>

<script type="text/javascript">
    jQuery(document).ready(function () {
        $(".btnDetails").click(function () {
            var itemGuid = $(this).attr("itemGuid");
            var baseUrl = '@Url.Action("ProductDetails", "Product")';
            var targetUrl = $.UrlUtil(baseUrl).concat("productGuid", itemGuid).show();
            window.location = targetUrl;
        });
    });
</script>
